﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace ConnectWithR
{
    public class RConnection : ESRI.ArcGIS.Desktop.AddIns.Button
    {
        public static Boolean hasInstance = false;
        public RConnection()
        {
        }

        protected override void OnClick()
        {
            //
            //  TODO: Sample code showing how to access button host
            //
            if (hasInstance)
            {
                MessageBox.Show("Only one window can be created");
                return;
            }


            ArcMap.Application.CurrentTool = null;
            Topmodel myForm = new Topmodel();
            hasInstance = true;
            myForm.Show();
        }
        protected override void OnUpdate()
        {
            Enabled = ArcMap.Application != null;
        }

      
    }

}
